/**
 * 
 */
package com.boot.springBoot.util;

/**
 * 本模块编写 一些简单的算法 以方便后面面试和工作中会运用到这种思想
 * 
 * 先从简单的排序算法做起来   一步步来
 * @author Administrator
 *
 */
public class ArithmeticUtil {
	
	private static int[] x = {100,2,200,1,3,5,7,4,8,6,9,20,10,30,400,300,40,50,250};
	
	private static String[] y = {"100","2","200","1","3","5","7","4","8","6",
							     "9","20","10","30","400","300","40","50","250"};

	
	/**
	 * 冒泡排序
	 */
	public  static String maoPaoArithmetic(int[] x) {
		if(x.length <= 0){
			return String.valueOf(x);
		}
		int temp=0;
		int y = x.length;
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < y-i-1; j++) {
				if(x[j] > x[j+1]){
					temp = x[j+1];
					x[j+1] = x[j];
					x[j] = temp;
				}
			}
			System.out.print(x[i]+",");
		}
		return x.toString();
	}
	
	/**
	 * 动手实践 验证
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(maoPaoArithmetic(x));
		
	}

}
